<?php
require_once 'system/core/Model.php';

class Req_Data_Model extends CI_Model{

	function __construct(){
		parent::__construct();
	}

	var $r_data;

	function get_rdata($ID, $user, $content){
		return $this->r_data = array("ID"=>$ID, "User"=>$user, "Content"=>$content);
	}

	function insert_rdata($user, $content){
		$data = $this->get_rdata(1, $user, $content);
		unset($data["ID"]);
		$this->db->insert("req_data", $data);
	}

	function delete_rdata($ID){
		$this->db->where("ID", $ID);
		$this->db->delete("req_data");
	}

	function update_rdata($ID, $user, $content){
		$data = $this->get_rdata($ID, $user, $content);
		$this->db->where("ID", $ID);
		$this->db->update("req_data", $data);
	}

	function query_rdata_by_ID($ID){
		$this->db->where("ID", $ID);
		return $this->db->get("req_data");
	}

	function query_rdata($limit, $offset){
		return $this->db->get("req_data", $limit, ($offset-1)*$limit);
	}

	function getALL(){
		return $this->db->get("req_data");
	}

}
?>